import request from "@/util/request"

export const getAllTemplateAPI = (userId) => {
    return request.get("/template/getall/" + userId)
}

// 收藏模板API
export const starTemplateAPI = (userId, templateId) => {
    const data = {
        "userId": userId,
        "templateId": templateId
    }
    return request.post("/template/star", data)
}

// 取消收藏模板API
export const unstarTemplateAPI = (userId, templateId) => {
    const url = `/template/unstar?userId=${userId}&templateId=${templateId}`
    return request.delete(url)
}

// 根据类型获取模版列表
export const getTemplateByTypeAPI = (userId, type) => {
    const url = `/template/getByType?userId=${userId}&type=${type}`
    return request.get(url)
}